'use strict';
exports.main = async (event, context) => {
  const db = uniCloud.database()
  const { userId, status } = event
  
  try {
    await db.collection('user')
      .doc(userId)
      .update({
        status: status
      })
    
    return { code: 0, message: '操作成功' }
  } catch (error) {
    console.error('更新状态失败:', error)
    return { code: 500, message: '操作失败' }
  }
}